﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Content/Master.Master" Inherits="System.Web.Mvc.ViewPage<SCS.Core.ViewModels.ListMetadataViewModels>" %>
<%@ Import Namespace="SCS.Core" %>
<%@ Import Namespace="SCS.Core.Models" %>
<%@ Import Namespace="SCS.Core.ViewModels" %>
<%@ Import Namespace="SCS.Core.Controllers" %>
<%@ Import Namespace="SCSService" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Meatadata
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript" src="/ThemeExtends/AdminSkin/js/jquery.flot.js"></script>
<script type="text/javascript" src="/ThemeExtends/AdminSkin/js/jquery.flot.stack.js"></script>	
 
<% using (Html.BeginForm("ListMetadata", "AdvantageSetting", FormMethod.Post, new { id = "sendFileForm", enctype = "multipart/form-data" }))
   {%>
    <div class="clear"></div>
    <div class="column full">
    <div class="box ">
		<h2 class="box-header">	Danh sách Metadata </h2>
		<div class="box-content">

                    <div id="grid">
        
		                <div style="margin: 5px; float:right;">  <%= Html.ActionLink("Tạo Metadata", "CreateMetadata", null, new { @Class = "button themed" })%></div>
				    						               
				               <table class="display" id="tabledata">
                                <thead>
					                <tr>				               
						                <th>
							               
								                MetaTitle
						                </th>
						
						                <th>
							                    Trang
						                </th>
                                        
                                        <th>
                                                Menu
                                        </th>											                
                                        
                                        <th>
                                                Param
                                        </th>
                                        <th></th>
                                        <th></th>
					                </tr>
                                   <%-- <tr>                                       
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td>
                                            <%= Html.ActionLink("Tạo Metadata", "CreateMetadata", null, new { @Class = "button themed" })%>
                                        </td>
                                    </tr>--%>
                                   <%-- <tr>
                                        <td>
                                            <%=Html.TextBoxFor(m=>m.TitleSearch, new { @class = "form-field hafl", @maxlength = "200" })%>
                                        </td>
                                        <td>
                                            
                                        </td>
                                        <td>
                                            
                                        </td>
                                        <td></td>
                                        <td></td>
                                        <td>
                                            <input type="submit" value="Tìm kiếm" class="button themed"/>
                                        </td>
                                    </tr>--%>
                                </thead>
                                <% if (Model.MetadataItem.Count() == 0)
                                   { %>
			                        <tbody>
                                        <tr>
                                            <td colspan="6">
                                                Không tìm thấy Metadata
                                            </td>
                                        </tr>
                                    </tbody>
		                        <% } else { %>
                                <tbody>
					                <% foreach (var item in Model.MetadataItem) { %>
				    
						                <tr>						                
                                            <td>
                                               <%= item.MetaTitle %>
                                            </td>

                                            <td>
                                               <%
                                                   string pageName = "";
                                                 if (item.PageID != null) {
                                                     pageName= ConfigModel.GetPageByID(item.PageID).PageName;
                                                 } %>
                                                 <%=pageName %>
                                            </td>

                                            <td>
                                                <% 
                                                    string menutext = "";
                                                    if (item.MenuId != null) {
                                                        menutext = ConfigModel.GetMenuByID(item.MenuId).MenuText;
                                                   } %>
                                            </td>

                                            <td>
                                                <%=item.Param %>
                                            </td>
                                                                                        
                                            <td>   
								               <%-- <%= Html.ActionLink("Cập nhật", "EditMetadata", new { id = item.MetaID })%>	--%>	
                                                <span class="button white"> <%= Html.ActionLink(" ", "EditMetadata", new { id = item.MetaID }, new { @class = "icon_single edit", style = "color:#f7a468;" })%></span>	<!--cap nhat-->						                
							                </td>
                                            
                                            <td>
                                                <%
                                                    string returnUrl = Request.Url.ToString();
                                                 %>
                                              <%--  <%= Html.ActionLink("Xóa", "DeleteMetadata", new { id = item.MetaID, returnUrl = returnUrl }, new { onclick = "return confirm('Are you sure delete ?');" })%>--%>
                                              <span class="button white"><%= Html.ActionLink(" ", "DeleteMetadata", new { id = item.MetaID, returnUrl = returnUrl }, new { @class = "icon_single cancel", style = "color:#cc0000;", onclick = "return confirm('Bạn thực sự muốn xóa?');" })%></span>

                                            </td>
						                </tr>
				    
					                <% } %>
					            </tbody>
                                <% } %>
				                </table>
			                <!-- data -->
                                <% if (Model.MetadataItem.Count() > 0)
                                   { %>
			                       <% Html.RenderPartial("~/Views/Commont/Paging.ascx"); %>
		                        <% } %>
		                
	                </div>  <!-- grid -->	
                
               
	    </div>
	</div>
    <div class="clear"></div>
    </div>    
<% } %>

</asp:Content>
